import request from './request'

let BaseUrl = '/api/shops'

// 获取正在售卖的全部商品，分页
// export const getShopByStatus = (data)=>{
//     return  request({url:BaseUrl+'/getShopByStatus', method:'post', data})
// }

// 艺术品详情
export const getShopById = (id) => {
    return request({
        url: BaseUrl + '/getShopById',
        method: 'post',
        data: {
            id
        }
    })
}

// 获取轮播图
export const getAds = () => {
    return request({
        url: BaseUrl + '/getAd',
        method: 'get'
    })
}

// 主页分类获取，分页，筛选
// data：
// "pageSize": "3", 
// "pageIndex": "1", 
// "user_address": "1", 
// "classify": "图片", 
// "form_of_sale": "拍卖", 
// "minprice": "1", 
// "maxprice": "1000" 
export const getShopByClassifyAndForm = (data) => {
    return request({
        url: BaseUrl + '/getShopByClassifyAndForm',
        method: 'post',
        data
    })
}

// 获取创建的合集
export const getMyArray = (pageIndex, pageSize) =>{
    return request({url:BaseUrl + '/getMyArray', method:'post', data:{pageIndex, pageSize}})
}

// 添加商品
// "title": "商品1", 
// "classify": "绘画", 
// "shop_hash": "hash值", 
// "cover_hash": "1111", 
// "form_of_sale": "定价出售", 
// "price": "1000", 
// "info": "测试", 
// "creator_address": "1", 
// "commission": "2" 
export const putShop = (data)=>{
    return request({url:BaseUrl + '/putShop', method:'post', data})
}


// 获取自己创作的nft
export const getMyNft = (pageIndex, pageSize)=>{
    return request({url:BaseUrl + '/getMyNft', method:"post", data:{pageIndex, pageSize}})
} 

// 获取自己正在售卖
export const getMySelling = (pageIndex, pageSize)=>{
    return request({url:BaseUrl + '/getMySelling', method:'post', data:{pageIndex, pageSize}})
}

// 获取自己未上架的商品（审核中，审核成功，审核失败）
export const getMyShopByAudit = (data)=>{
    return request({url:BaseUrl + '/getMyShopByAudit', method:'post', data})
}

// 我的收藏
// "pageSize": "2", 
// "pageIndex": "1", 
// "type": "shop" 
export const getMyColletion = (data)=>{
    return request({url:BaseUrl + '/getMyColletion', method:'post', data})
}

// 收藏获取取消收藏
// "user_address": "1", 
// "shop_id": "12", 
// "type": "array" 
export const collete = (data)=>{
    return request({url:BaseUrl + '/collete', method:'post', data})
}


export const getSearch = (data)=>{
    return request({url:BaseUrl + '/getSearch', method:'post', data})
}


// 艺术家个人中心商品合集
// "pageSize": "3", 
// "pageIndex": "1", 
// "other_address": "2" 
export const getOtherArray = (data)=>{
    return request({url:BaseUrl + '/getOtherArray', method:'post', data})
}

// 获取他人铸造的nft
// "pageSize": "3", 
// "pageIndex": "1", 
// "other_address": "2" 
export const getOtherNft = (data)=>{
    return request({url:BaseUrl + '/getOtherNft', method:'post', data})
}

// 获取他人正在售卖的商品
// "pageSize": "3", 
// "pageIndex": "1", 
// "other_address": "2" 
export const getOtherSelling = (data) =>{
    return request({url:BaseUrl + '/getOtherSelling', method:'post', data})
}

// 获取他人喜欢的商品或合集
// "pageSize": "3", 
// "pageIndex": "1", 
// "other_address": "2", 
// "type": "shop" 
export const getOtherColletion = (data)=>{
    return request({url:BaseUrl + '/getOtherColletion', method:'post', data})
}

// 指定日期的拍卖会
export const queryAuctionByDate = (dateString)=>{
    return request({url:BaseUrl + '/queryAuctionByDate', method:'post', data:{date:dateString}})
}

// 获取热门商品
// "pageSize": "3", 
// "pageIndex": "1", 
// "type": "shop", 
// "classify": "图片", 
// "form_of_sale": "拍卖", 
// "minprice": "1", 
// "maxprice": "1000" 
export const getShopByHot = (data)=>{
    return request({url:BaseUrl + '/getShopByHot', method:'post', data})
}

// 获取自己买的商品
export const getMySold = (data)=>{
    return request({url:BaseUrl + '/getMySold', method:'post', data})
}

// 获取用户参与的拍卖会
export const getParticipateAuction = (user_addres)=>{
    return request({url:BaseUrl + '/getParticipateAuction', method:'post', data:{user_addres}})
}

// // 测试接口
// async function test() {
//     let result = await getShopByClassifyAndForm({
//         "pageSize": "3",
//         "pageIndex": "1",
//         "user_address": "1",
//         "classify": "图片",
//         "form_of_sale": "拍卖",
//         "minprice": "1",
//         "maxprice": "1000"
//     })
//     console.log(result)
// }
// test()